package cn.hahah.module.blog.dal.mysql.usercode;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.usercode.UserCodeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.usercode.vo.*;

/**
 * 博客系统用户验证码 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserCodeMapper extends BaseMapperX<UserCodeDO> {

    default PageResult<UserCodeDO> selectPage(UserCodePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserCodeDO>()
                .eqIfPresent(UserCodeDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserCodeDO::getCode, reqVO.getCode())
                .betweenIfPresent(UserCodeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserCodeDO::getId));
    }

}